import typing
from pydantic_settings import BaseSettings

class Settings(BaseSettings):
    QMT_DIR: str = r'D:\江海证券QMT实盘_交易\userdata_mini'
    ACC: str = "80395788"
    API: str = "http://127.0.0.1:9188/api/data/jiaoyi/add_orders"
    STOCK_CODE: typing.List = [
        {"id": "513130", "name": "恒生科技", "all_code": "513130.SH", "type": 1, "span": 0.001, "volume": 1000,"min_rsi":5,"down":0.003},
        # {"id": "513060", "name": "恒生医疗", "all_code": "513060.SH", "type": 1, "span": 0.001, "volume": 1000,"min_rsi":5,"down":0.003},
        # {"id": "000838", "name": "财信发展", "all_code": "000838.SZ", "type": 1, "span": 0.01, "volume": 10000,"min_rsi": 5, "down": 0.003},  ##1.5

        {"id": "513120", "name": "港股创新药", "all_code": "513120.SH", "type": 1, "span": 0.001, "volume": 50000,
         "min_rsi": 5, "down": 0.003},  ##1.5
        {"id": "513090", "name": "香港证券", "all_code": "513090.SH", "type": 1, "span": 0.002, "volume": 40000,
         "min_rsi": 5, "down": 0.012},  ##2.3
        # {"id": "513050", "name": "中概互联网", "all_code": "513050.SH", "type": 1, "span": 0.001, "volume": 45000,
        #  "min_rsi": 5, "down": 0.003},  ##中概波动太小只能千1
        {"id": "513750", "name": "港股通非银", "all_code": "513750.SH", "type": 1, "span": 0.001, "volume": 40000,
         "min_rsi": 5, "down": 0.005},  ##1.73
        # {"id": "513310", "name": "中韩半导体", "all_code": "513310.SH", "type": 1, "span": 0.002, "volume": 35000,
        #  "min_rsi": 5, "down": 0.008},  ##1.937

        # {"id": "513120", "name": "港股创新药", "all_code": "513120.SH", "type": 1, "span": 0.001, "volume": 1000,
        #  "min_rsi": 5, "down": 0.003},  ##1.5
        # {"id": "513090", "name": "香港证券", "all_code": "513090.SH", "type": 1, "span": 0.002, "volume": 1000,
        #  "min_rsi": 5, "down": 0.012},  ##2.3
        # {"id": "513050", "name": "中概互联网", "all_code": "513050.SH", "type": 1, "span": 0.001, "volume": 1000,
        #  "min_rsi": 5, "down": 0.003},  ##中概波动太小只能千1
        # {"id": "513750", "name": "港股通非银", "all_code": "513750.SH", "type": 1, "span": 0.001, "volume": 1000,
        #  "min_rsi": 5, "down": 0.005},  ##1.73
        # {"id": "513310", "name": "中韩半导体", "all_code": "513310.SH", "type": 1, "span": 0.002, "volume": 1000,
        #  "min_rsi": 5, "down": 0.008},  ##1.937



    ]
    UPDOWN_TIME:int = 60  ##横盘时间,60个tick,约3分钟
    UPDOWN_SPAN:float = 0.2 ##横盘区间大小
    GIVE_SPAN:int = 3 ##止损挡位,往下两档
    # ATR 配置
    ATR_LOOKBACK:int = 14  # 日内分钟级建议 7~14
    ATR_X:float = 0.4      # ATR 倍数（2~5），用于阈值放大
    # 死叉保护时间配置（分钟）
    DEATH_CROSS_PROTECTION_MINUTES:int = 5  # 死叉出现后30分钟内不允许买入
    ##当日股票乐观程度: 1强势下跌2看跌3一般4看涨5强势上涨，可以看自选股红色数量来判断或者新闻情绪
    DAY_LOOK:int = 1 ##默认为3,一般情况


settings = Settings()
